import Vue from 'vue';
import Vuex from 'vuex';
import { storeImporter } from "./Importer";
Vue.use(Vuex);

const modules = storeImporter.import();

export const store = new Vuex.Store({
  state: {
    _vue: {}
  },
  getters: {
    route: (state) => state._vue.$route,
    router: (state) => state._vue.$router
  },
  actions: {
    /**
     * 初始化状态管理器
     * @param {object} context 状态管理器
     * @param {object} vue Vue实例对象
     */
    init: function ({ state }, vue) {
      state._vue = vue;
    }
  },
  modules
});
